package com.xilihui.xlh.business.requests;

import android.content.Context;

import com.xilihui.xlh.business.entities.ItemsEntity;
import com.xilihui.xlh.business.entities.ShopEntity;
import com.xilihui.xlh.core.app.BaseEntity;
import com.xilihui.xlh.core.http.HttpManager;
import com.xilihui.xlh.core.util.LogUtil;
import com.xilihui.xlh.core.util.SPUtil;

import rx.Observable;


/**
 * Created by Administrator on 2018/6/21.
 */

public class AppointmentRequest {
    
    public static AppointmentService yuyueService = HttpManager.getRetrofit().create(AppointmentService.class);

    /**
     * 门店列表
     * @param lng
     * @param lat
     * @param page
     * @param order
     * @return
     */
    public static Observable<ShopEntity> shoplist(Context context,String lng, String lat, int page,
                                                  String keyword,String order){
        String access_token = (String) SPUtil.get(context,SPUtil.TOKEN,"");
        LogUtil.i("mylog","access_token:"+access_token);
        return yuyueService.shoplist(access_token,lng,lat,page,keyword,order);
    }
    

    /**
     * 门店预约项目
     * @param id
     * @return
     */
    public static Observable<ItemsEntity> items(int id){
        return yuyueService.items(id);
    }

    /**
     * 提交我要预约
     * @param context
     * @param agent_id
     * @param project_id
     * @param seat_type
     * @param start_time
     * @param end_time
     * @return
     */
    public static Observable<BaseEntity> submit(Context context,int agent_id,int project_id,int seat_type
    ,long start_time,long end_time,String remark){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return yuyueService.submit(access_token,agent_id,project_id,seat_type,start_time,end_time,remark);
    }

    /**
     * 立即预约-扫二维码
     * @param id
     * @return
     */
    public static Observable<ItemsEntity> lijiyuyue(int id){
        return yuyueService.lijiyuyue(id);
    }

    /**
     * 立即预约-提交
     * @param context
     * @param project_id
     * @param seat_type
     * @param check_start_time
     * @param remark
     * @return
     */
    public static Observable<BaseEntity> lijiyuyueSubmit(Context context,String agent_id,String project_id,String seat_type,
                                                   String check_start_time,String remark){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return yuyueService.lijiyuyueSubmit(access_token,agent_id,project_id,seat_type,check_start_time,remark);
    }

    /**
     * 提示
     * @param context
     * @param id
     * @return
     */
    public static Observable<BaseEntity> hint(Context context,String id){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return yuyueService.hint(access_token,id);
    }

    /**
     * 到店取消判断
     * @param context
     * @param id
     * @return
     */
    public static Observable<BaseEntity> panduan(Context context,String id){
        String access_token = (String)SPUtil.get(context,SPUtil.TOKEN,"");
        return yuyueService.panduan(access_token,id);
    }
    
}
